package com.education.mapper;

import com.education.domain.Tbtest;
import com.education.domain.TbtestExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface TbtestMapper {
    @SelectProvider(type=TbtestSqlProvider.class, method="countByExample")
    int countByExample(TbtestExample example);

    @DeleteProvider(type=TbtestSqlProvider.class, method="deleteByExample")
    int deleteByExample(TbtestExample example);

    @Delete({
        "delete from tbtest",
        "where lId = #{lid,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer lid);

    @Insert({
        "insert into tbtest (nTimes, strTestName, ",
        "lCreatorId, lClassId, ",
        "lCourseId, nGrade, ",
        "nHalfTerm, dtCreatTime, ",
        "dtModifyTime)",
        "values (#{ntimes,jdbcType=INTEGER}, #{strtestname,jdbcType=VARCHAR}, ",
        "#{lcreatorid,jdbcType=INTEGER}, #{lclassid,jdbcType=INTEGER}, ",
        "#{lcourseid,jdbcType=INTEGER}, #{ngrade,jdbcType=INTEGER}, ",
        "#{nhalfterm,jdbcType=INTEGER}, #{dtcreattime,jdbcType=TIMESTAMP}, ",
        "#{dtmodifytime,jdbcType=TIMESTAMP})"
    })
    @Options(useGeneratedKeys=true,keyProperty="lid")
    int insert(Tbtest record);

    @InsertProvider(type=TbtestSqlProvider.class, method="insertSelective")
    @Options(useGeneratedKeys=true,keyProperty="lid")
    int insertSelective(Tbtest record);

    @SelectProvider(type=TbtestSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="lId", property="lid", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="nTimes", property="ntimes", jdbcType=JdbcType.INTEGER),
        @Result(column="strTestName", property="strtestname", jdbcType=JdbcType.VARCHAR),
        @Result(column="lCreatorId", property="lcreatorid", jdbcType=JdbcType.INTEGER),
        @Result(column="lClassId", property="lclassid", jdbcType=JdbcType.INTEGER),
        @Result(column="lCourseId", property="lcourseid", jdbcType=JdbcType.INTEGER),
        @Result(column="nGrade", property="ngrade", jdbcType=JdbcType.INTEGER),
        @Result(column="nHalfTerm", property="nhalfterm", jdbcType=JdbcType.INTEGER),
        @Result(column="dtCreatTime", property="dtcreattime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="dtModifyTime", property="dtmodifytime", jdbcType=JdbcType.TIMESTAMP)
    })
    List<Tbtest> selectByExample(TbtestExample example);

    @Select({
        "select",
        "lId, nTimes, strTestName, lCreatorId, lClassId, lCourseId, nGrade, nHalfTerm, ",
        "dtCreatTime, dtModifyTime",
        "from tbtest",
        "where lId = #{lid,jdbcType=INTEGER}"
    })
    @Results({
        @Result(column="lId", property="lid", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="nTimes", property="ntimes", jdbcType=JdbcType.INTEGER),
        @Result(column="strTestName", property="strtestname", jdbcType=JdbcType.VARCHAR),
        @Result(column="lCreatorId", property="lcreatorid", jdbcType=JdbcType.INTEGER),
        @Result(column="lClassId", property="lclassid", jdbcType=JdbcType.INTEGER),
        @Result(column="lCourseId", property="lcourseid", jdbcType=JdbcType.INTEGER),
        @Result(column="nGrade", property="ngrade", jdbcType=JdbcType.INTEGER),
        @Result(column="nHalfTerm", property="nhalfterm", jdbcType=JdbcType.INTEGER),
        @Result(column="dtCreatTime", property="dtcreattime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="dtModifyTime", property="dtmodifytime", jdbcType=JdbcType.TIMESTAMP)
    })
    Tbtest selectByPrimaryKey(Integer lid);

    @UpdateProvider(type=TbtestSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") Tbtest record, @Param("example") TbtestExample example);

    @UpdateProvider(type=TbtestSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") Tbtest record, @Param("example") TbtestExample example);

    @UpdateProvider(type=TbtestSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(Tbtest record);

    @Update({
        "update tbtest",
        "set nTimes = #{ntimes,jdbcType=INTEGER},",
          "strTestName = #{strtestname,jdbcType=VARCHAR},",
          "lCreatorId = #{lcreatorid,jdbcType=INTEGER},",
          "lClassId = #{lclassid,jdbcType=INTEGER},",
          "lCourseId = #{lcourseid,jdbcType=INTEGER},",
          "nGrade = #{ngrade,jdbcType=INTEGER},",
          "nHalfTerm = #{nhalfterm,jdbcType=INTEGER},",
          "dtCreatTime = #{dtcreattime,jdbcType=TIMESTAMP},",
          "dtModifyTime = #{dtmodifytime,jdbcType=TIMESTAMP}",
        "where lId = #{lid,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(Tbtest record);
}